package generic;

import org.junit.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * author : yeswater
 * date : 2023/7/17
 */

public class GenericTest {

    @Test
    public void test() {
        int i = 5;
        i = i >>> 1;
        System.out.println(i);
    }

    @Test
    public void test1() {
        System.out.println("hello");
        List<?> list = null;
        ArrayList<String> list1 = new ArrayList<>();
        list1.add("abc");
        list = list1;

        Object o = list.get(0);

    }

    /**
     * <E> 声明 E 是泛型 而不是类, E 声明返回类型,
     */
    public <E> E method(E e) {
        return e;
    }

    @Test
    public void test3() {
        HashMap<String, String> map = new HashMap(16);
        // map.put("1", "lucas");
        System.out.println(map.size());
    }

}
